<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" +
			request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<meta name="renderer" content="webkit">
	<title>登录</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
	<link rel="shortcut icon" href="<%=basePath%>static/favicon.ico" type="image/x-icon" />
	<link rel="stylesheet" href="<%=basePath%>static/css/font.css">
	<link rel="stylesheet" href="<%=basePath%>static/css/xadmin.css">
	<script src="<%=basePath%>static/js/jquery.js"></script>
	<script src="<%=basePath%>static/js/pintuer.js"></script>
	<script type="text/javascript" src="<%=basePath%>static/js/jquery-3.5.0.js">
	</script><script src="<%=basePath%>static/lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="<%=basePath%>static/js/xadmin.js"></script>
</head>
<body style="background-image: url('/static/images/99.jpg')">
<div class="container">
	<div class="line bouncein">
		<div class="xs6 xm4 xs3-move xm4-move">
			<div style="height:150px;"></div>
			<div class="media media-y margin-big-bottom" style="font-size: x-large;color: red">
				华清专业医院登录系统
			</div>
			<form action="" method="post" class="layui-form">
				<input name="username" placeholder="用户名" id="username"  type="text" class="layui-input" >
				<hr class="hr15">
				<input name="password" placeholder="密码" id="password"  type="password" class="layui-input">
				<hr class="hr15">
				<input value="登录" style="width: 100%;height: 35px;background-color: #00aa00" type="button" onclick="login()">
				<hr class="hr20" >
				<a href="../sys/signIn"><input value="注册" style="width:100%; height: 35px;background-color: #8a6d3b" type="button"></a>
			</form>
		</div>
	</div>
</div>

<script>
	function login() {
		console.log("你好")
		$.ajax({
			url:"../role/login",
			dataType:"json",
			type:"post",
			data:{
				"username":$("#username").val(),
				"password":$("#password").val(),
			},success:function (data) {
				if(data.code == "管理员"){
					location.href = '../sys/adminIndex';
				}else if (data.code == "医生"){
					location.href = '../sys/doctorIndex';
				} else if (data.code == "群众"){
					location.href = '../sys/massIndex';
				}else {
					alert(data.loginInfo);
					location.reload();
				}
			},error:function () {
				alert("服务器错误");
			}
		})
	}
</script>

</body>
</html>